#include <stdio.h>
#include <stdlib.h>

int
main(void)
{
	static int AM[100][100];
	int n = 0, m = 0;
	int i = 0, j = 0, k = 0;
	int a = 0, b = 0;
	static int T[100];

	scanf("%d%d", &n, &m);

	i = 0;
	while (i < m) {
		scanf("%d%d", &a, &b);
		a--;
		b--;
		AM[a][b]++;
		AM[b][a]++;
		i++;
	}

	a = 1; /* 1 - YES; 0 - NO */
	for (i = 0; i < n; i++) {
		for (j = 0; j < n; j++) {
			if (AM[i][j]) {
				k = j+1;
				while (k < n) {
					if (k == i) {
						k++;
						continue;
					}
					if (AM[i][k] &&
					    AM[k][j]) {
						j = k;
						break;
					} else {
						a = 0;
						fputs("3-while - if\n", stderr);
						puts("NO");
						return 0;
					}
					k++;
				}
			}
		}
	}
	fputs("f\n", stderr);
	a ? puts("YES") : puts("NO");

	return 0;
}
